<template>
    <div>
        <el-table
                border
                ref="multipleTable"
                :data="oppoList"
                tooltip-effect="dark"
                style="width: 100%"
                @row-click="openDrawer"
                id="oppotable"
        >
            <el-table-column prop="oppoName" label="机会名称" :show-overflow-tooltip="true"></el-table-column>
            <el-table-column prop="customer.customerName" label="客户名称" :show-overflow-tooltip="true"></el-table-column>
            <el-table-column prop="worker.empName" label="业务员" :show-overflow-tooltip="true"></el-table-column>
            <el-table-column prop="state.oppoStateName" label="机会状态" :show-overflow-tooltip="true"></el-table-column>
            <el-table-column prop="stateDate" label="添加时间" :show-overflow-tooltip="true">
                <template slot-scope="s">
                    {{s.row.stateDate | formatDate}}
                </template>
            </el-table-column>
            <el-table-column prop="nextContactTime" label="推进到当前阶段的时间" :show-overflow-tooltip="true">
                <template slot-scope="s">
                    {{s.row.nextContactTime | formatDate}}
                </template>
            </el-table-column>
            <el-table-column prop="nextContactTime" label="此阶段已停留时间(天)" :show-overflow-tooltip="true">
                <template slot-scope="s">
                    {{((new Date().getTime()-new Date(s.row.nextContactTime).getTime())/(1000*60*60*24)).toFixed(0) }}
                </template>
            </el-table-column>
            <el-table-column prop="planIdealTime" label="预计成交时间" :show-overflow-tooltip="true">
                <template slot-scope="s">
                    {{s.row.planIdealTime | formatDate}}
                </template>
            </el-table-column>
            <el-table-column prop="detail" label="详情" :show-overflow-tooltip="true"></el-table-column>
        </el-table>
    </div>
</template>

<script>
    import {formatTimeToStr} from '@/assets/format.js'
    export default {
        name: "oppoTable",
        props: ['oppoList','oppostates','state'],
        data:function() {
            return {
                totalPrice:0
            }
        },
        methods:{
            openDrawer(obj){
                this.$parent.$parent.$parent.drawer = true;
                this.$parent.$parent.$parent.oppotunity = this.global.copy_obj(obj);
            }

        },
        computed:{

        },
        filters: {
            formatDate: function(time) {
                if(time!=null&&time!="")
                {
                    var date = new Date(time);
                    return formatTimeToStr(date, "yyyy-MM-dd");
                }else{
                    return "";
                }
            }
        }
    }
</script>

<style>
    .el-dropdown-link {
        cursor: pointer;
        color: #409EFF;
    }
    .el-icon-arrow-down {
        font-size: 12px;
    }
    #oppotable .el-select input[type="text"]{border: none !important;background-color:transparent; padding: 0px;width: 90px;color: black}
    #oppotable input::-webkit-input-placeholder{
        color: black;
    }

</style>